package com.github.kezhenxu94.playground.java.interview.xiaomi;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class XiaoMiReverString {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNextLine()) {
			String line = sc.nextLine();
			String[] words = line.split(" ");
			List<String> wordList = Arrays.asList(words);
			Collections.reverse(wordList);
			String collect = wordList.stream().collect(Collectors.joining(" "));
			System.out.println(collect);
		}
		sc.close();
	}
}
